#include<stdio.h>
int main()
{
	int year,month,day,a,i=1,d,sum=0;
	scanf("%d/%d/%d",&year,&month,&day);
	if(year%4==0&&year%100!=0||year%400==0) a=29;
	else a=28;
	while(i<month){
		switch(i){
			case 1:d=31;break;
			case 2:d=a;break;
			case 3:d=31;break;
			case 4:d=30;break;
			case 5:d=31;break;
			case 6:d=30;break;
			case 7:d=31;break;
			case 8:d=31;break;
			case 9:d=30;break;
			case 10:d=31;break;
			case 11:d=30;break;
			case 12:d=31;break;
		}
		sum+=d;
		i++;
	}
	printf("%d",sum+day);
}
